import request from '@/utils/request'

export default {
  // 8.发布课程
  PublishCourseById(courseId) {
    return request({
      url: `/admin/edu/course/publish-course/${courseId}`,
      method: 'put'
    })
  },
  // 7.查询课程发布信息
  getCoursePublish(courseId) {
    return request({
      url: `/admin/edu/course/course-publish/${courseId}`,
      method: 'get'
    })
  },
  // 5.根据id查询章节
  getChapter(chapterId) {
    return request({
      url: `/admin/edu/chapter/get/${chapterId}`,
      method: 'get'
    })
  },
  // 6.更新章节
  updateChapter(chapter) {
    return request({
      url: `/admin/edu/chapter/update`,
      method: 'put',
      data: chapter
    })
  },
  // 4.删除章节
  removeChapter(chapterId) {
    return request({
      url: `/admin/edu/chapter/remove/${chapterId}`,
      method: 'delete'
    })
  },
  // 3.查询课程的章节的课时嵌套集合
  chapterNestedList(courseId) {
    return request({
      url: `/admin/edu/chapter/list/${courseId}`,
      method: 'post'
    })
  },
  // 第二步：保存章节
  saveChapter(chapter) {
    return request({
      url: '/admin/edu/chapter/save-chapter',
      method: 'post',
      data: chapter
    })
  },
  // 第一步：保存课程基本信息
  saveCourseInfo(course) {
    return request({
      url: '/admin/edu/course/save-course-info',
      method: 'post',
      data: course
    })
  }
}
